package com.zfast.config.game.menus;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashSet;
import java.util.Set;

/**
 * 菜单选项
 * Menus
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MenuItem {
    @ApiModelProperty("指令")
    protected String command;
    @ApiModelProperty("描述")
    protected String description;
    @ApiModelProperty("自定义指令")
    protected Set<String> altCommands;

    public MenuItem(String command, String description) {
        this.command = command;
        this.description = description;
        this.altCommands = new HashSet<String>();
    }

    public MenuItem(String command, String description, String... altCommands) {
        this(command, description);
        for (String altCommand: altCommands) {
            this.altCommands.add(altCommand);
        }
    }

    /**
     * 返回指令的小写模式
     * @auther zgn
     * @date  2022/10/5
     **/
    public String getKey() {
        return getCommand().toLowerCase();
    }
}
